﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPages/MasterPage.master" AutoEventWireup="true" CodeFile="LoanCalculator.aspx.cs" Inherits="Pages_Public_LoanCalculator" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageHeader" Runat="Server">

   

</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="PageBody" Runat="Server">

    <h4 id="h4Heading" runat="server">Loan Amortization Schedule </h4>

        <asp:Panel ID="pnlFormContainer" runat="server">
        <div class="WizardContainer">
            <div class="StepHeaderContainer">
                <div class="StepHeading">
                    <asp:Label ID="lblMemberShipType" runat="server" Text="Loan Amortization Schedule"></asp:Label>
                </div>
                <div class="StepSubHeading"><asp:Label ID="Label1" runat="server" Text="Provide following information and get Loan amortization schedule."></asp:Label></div>
            </div>
            <div class="StepBody">
                <table cellpadding="3" cellspacing="0" style="width:70%;">
                   <colgroup>
                        <col style="width:38%;" />
                        <col />
                    </colgroup>  
                    <tr>
					    <td><asp:Label ID="lblLoanAmount" runat="server" Text="Loan Amount"></asp:Label><span class="requiredMark">*</span></td>
					    <td>
						    <asp:TextBox ID="txtLoanAmount" MaxLength="15" runat="server"></asp:TextBox>
						    
                            <asp:RequiredFieldValidator ID="rfvLoanAmount" runat="server"
							    ControlToValidate="txtLoanAmount" SetFocusOnError="true"
							    ErrorMessage="Please Enter Loan Amount." Display="Dynamic"
                                ValidationGroup="SaveInfo">
						    </asp:RequiredFieldValidator>

                            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" runat="server" 
                                ValidationExpression="^[1-9]([0-9]+)?"
                                ControlToValidate="txtLoanAmount" Display="Dynamic" SetFocusOnError="true"
                                ErrorMessage="Please enter an integer greater than zero."
                                ValidationGroup="SaveInfo">
                            </asp:RegularExpressionValidator>

                           
					    </td>
				    </tr>

				    <tr>
					    <td><asp:Label ID="Label2" runat="server" Text="Interest Rate (%)"></asp:Label><span class="requiredMark">*</span></td>
					    <td>
						    <asp:TextBox ID="txtInterestRate" MaxLength="10" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="rfvInterestRate" runat="server"
							    ControlToValidate="txtInterestRate" SetFocusOnError="true"
							    ErrorMessage="Please Enter a Interest Rate." Display="Dynamic"
                                ValidationGroup="SaveInfo">
						    </asp:RequiredFieldValidator>

                            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" 
                                ValidationExpression="(?!^0*$)(?!^0*\.0*$)^\d{1,2}(\.\d{1,3})?$"
                                ControlToValidate="txtInterestRate" Display="Dynamic" SetFocusOnError="true"
                                ErrorMessage="Please enter numeric value."
                                ValidationGroup="SaveInfo">
                            </asp:RegularExpressionValidator>
					    </td>
				    </tr>

                    <tr>
					    <td><asp:Label ID="Label5" runat="server" Text="Loan Term (in years)"></asp:Label><span class="requiredMark">*</span></td>
					    <td>
						    <asp:TextBox ID="txtLoanTermInYear" MaxLength="3" runat="server"></asp:TextBox>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
							    ControlToValidate="txtLoanTermInYear" SetFocusOnError="true"
							    ErrorMessage="Please Enter Loan Term (in years)." Display="Dynamic"
                                ValidationGroup="SaveInfo">
						    </asp:RequiredFieldValidator>

						    <asp:RangeValidator ID="RangeValidator1" runat="server" 
                                ErrorMessage="Value must be greater than zero and less than 100." 
                                ControlToValidate="txtLoanTermInYear" 
                                MinimumValue="1"
                                SetFocusOnError="true"
                                Display="Dynamic" 
                                MaximumValue="99" 
                                Type="Integer"
                                ValidationGroup="SaveInfo">
                            </asp:RangeValidator>
					    </td>
				    </tr>

				    <tr>
					    <td><asp:Label ID="lblReducingBalanceMethod" runat="server" Text="Reducing Balance based on"></asp:Label><span class="requiredMark">*</span></td>
					    <td>
						    <asp:DropDownList ID="ddlReducingBalanceMethod" runat="server">
                                <asp:ListItem Value="1">Yearly</asp:ListItem>
                                <asp:ListItem Value="12">Monthly</asp:ListItem>
                            </asp:DropDownList>
						    
					    </td>
				    </tr>
  			    				    
                </table>
            </div>
            <div class="StepButtonContainer">
                <asp:Button ID="btnSave" runat="server" Text="Calculate" ValidationGroup="SaveInfo" OnClick="btnSave_Click" />
            </div>
        </div>
    </asp:Panel>

    <asp:Panel ID="LoanSummary" runat="server" Visible="false">
    <div id="summary" class="GroupBox">
        <div class="GroupHeaderOverlay">Details</div>
        <div class="Welcomes">
            <table cellpadding="3" cellspacing="0" class="GridView">            
                <colgroup>
                    <col style="width:30%;" />
                    <col />
                </colgroup>
                <tr>
                    <td>Loan Amount</td><td><asp:Label ID="sLoanAmount" Text="" runat="server"></asp:Label></td>
                </tr>

                <tr>
                    <td>Loan Period</td><td><asp:Label ID="sLoanPeriod" Text="" runat="server"></asp:Label></td>
                </tr>

                <tr>
                    <td>Interest Rates for Annual Rests</td><td><asp:Label ID="sInterestRate" Text="" runat="server"></asp:Label></td>
                </tr>

                <tr>
                    <td>EMI</td><td><asp:Label ID="sEMI" Text="" runat="server"></asp:Label></td>
                </tr>

                <tr>
                    <td>Yearly Payment due to HFC</td><td><asp:Label ID="sYearlyPayment" Text="" runat="server"></asp:Label></td>
                </tr>

                <tr>
                    <td>Total Interest</td><td><asp:Label ID="sTotalInterest" Text="" runat="server"></asp:Label></td>
                </tr>

                <tr>
                    <td>Total Amount with Interest</td><td><asp:Label ID="sTotalAmountWithInterest" Text="" runat="server"></asp:Label></td>
                </tr>
            </table> 
        </div>

        <div id="detailsLoan" runat="server" style="margin-top:10px;"></div>
           
    </div>
    </asp:Panel>
  
</asp:Content>

